package com.xinqi.modules.prepare.courseware.service.impl;

import com.xinqi.common.core.enums.RocketMqSliceEnum;
import com.xinqi.common.third.oss.slice.event.OssSliceEvent;
import com.xinqi.modules.prepare.courseware.dto.req.PrepareCoursewareCreateDTO;
import com.xinqi.modules.prepare.courseware.service.PrepareCoursewareService;
import lombok.RequiredArgsConstructor;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;

/**
 * @author wenjie
 * @date 2023/8/16  15:38
 */

@Service("coursewareSliceService")
@RequiredArgsConstructor
public class CoursewareSliceService {

    private final OssSliceEvent ossSliceEvent;

    @Lazy
    private final PrepareCoursewareService prepareCoursewareService;

    public void coursewareSlice(PrepareCoursewareCreateDTO dto, Long courseWareId) {
        ossSliceEvent.createSliceImage(dto.getFiles().get(0).getUrl(), courseWareId, RocketMqSliceEnum.PREPARE_SLICE.getCode());
    }
}
